package com.isoft.dailymanprovidor.controller;

import com.isoft.dailymanprovidor.bean.ResponseData;
import com.isoft.dailymanprovidor.entity.MeetingReservation;
import com.isoft.dailymanprovidor.service.MeetingReservationService;
import lombok.extern.slf4j.Slf4j;
import org.apache.coyote.Response;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@CrossOrigin
@RestController
@Slf4j
@RequestMapping("/systemdailyman/meetingreservation")
public class MeetingReservationController extends BaseController{
    @Autowired
    MeetingReservationService meetingReservationService;
    //分页获取会议室预约全部信息
    @GetMapping("/getallmeetingroom")
    public ResponseData getallmeetingroom(Integer currentPage, Integer size){
        return meetingReservationService.getallmeetingroom(currentPage, size);
    }
    //分页获取会议室预约信息
    @GetMapping("/getallmeetingreservation")
    public ResponseData getallmeetingreservation(Integer currentPage, Integer size,String meetingroomname,String department,String status,String starttime,String endtime,String applicant){
        return meetingReservationService.getallmeetingreservation(currentPage, size, meetingroomname,department,status,starttime,endtime,applicant);
    }

    //新增会议室预约申请
    @PutMapping("/addmeetingreservation")
    public ResponseData<Boolean> addmeetingreservation(@RequestBody MeetingReservation meetingReservation){
        return returnBoolean(meetingReservationService.addmeetingreservation(meetingReservation));
    }
    //预约管理审核
    @PutMapping("/manupdatestatue")
    public ResponseData<Boolean> Manupdatestatue(@RequestBody MeetingReservation meetingReservation){
        return returnBoolean(meetingReservationService.Manupdatestatue(meetingReservation));
    }
    //修改会议室预约信息
    @PutMapping("/updatemeetingreservation")
    public ResponseData<Boolean> updatemeetingroom(@RequestBody MeetingReservation meetingReservation){
        return returnBoolean(meetingReservationService.updatemeetingroom(meetingReservation));
    }
    //撤销会议室预约信息
    @DeleteMapping("/deletemeetingreservation/{id}")
    public ResponseData<Boolean> deletemeetingreservation(@PathVariable("id") Integer id){
        return returnBoolean(meetingReservationService.deletemeetingroom(id));
    }
}
